import { HintBtnView } from "../../mapUI/HintBtnView";
import { LayerManager } from "../../../manager/LayerManager";
import { EffectManager } from "../../../manager/EffectManager";
import { ObjCreate } from "../../common/ObjCreate";
import { ResFileConst } from "../../../resource/ResFileConst";
import { Cache } from "../../../cache/Cache";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { GLoadedButton } from "../../../../../com/mui/controls/GLoadedButton";
import { SecTimerView } from "../../common/SecTimerView";
type int = number;
//class KingChampionShipHitBtn
    
    export  class KingChampionShipHitBtn extends HintBtnView
    {
        constructor()
        {
            super();
            this.layer = LayerManager.rightTopUILayer;
            this.createChildren();
            this.addListeners();
            return;
        }

        public showkingChampionShipEffect(arg1: Boolean): void
        {
            var loc1=null;
            var loc2=null;
            if (arg1) 
            {
                loc1 = new Object /* flash.filters.GlowFilter */(268435302, 1, 6, 6, 4);
                loc2 = [loc1];
                EffectManager.glowFilterReg(this._kingChampionShipBtn, loc2, 0.8, 10, 5, 0);
            }
            else 
            {
                EffectManager.glowFilterUnReg(this._kingChampionShipBtn);
            }
            return;
        }

        public setLeftTime(arg1: int): void
        {
            this.createSectimer();
            this._sectimer.setLeftTime(arg1);
            return;
        }

        /* internal  */createChildren(): void
        {
            this._kingChampionShipBtn = ObjCreate.createGLoadedButton(ResFileConst.KingChampionShipHintBtn, 0, 0, 60, 50, this);
            return;
        }

        /* internal  */addListeners(): void
        {
            this._kingChampionShipBtn.addEventListener(flash.events.MouseEvent.CLICK, this.clickkingChampionShipHandler);
            return;
        }

        protected clickkingChampionShipHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (Cache.instance.copy.isInKingChampionShip()) 
            {
                return;
            }
            EffectManager.glowFilterUnReg(this._kingChampionShipBtn);
            Dispatcher.dispatchEvent(new DataEvent(EventName.KingChampionShipShowEntranceReq));
            return;
        }

        /* internal  */createSectimer(): void
        {
            if (!this._sectimer) 
            {
                this._sectimer = ObjCreate.createSecTimeView("hh: mm: ss", -10, 55, 80, 20, this, GlobalStyle.getTextFormatCenter(GlobalStyle.textFormat1));
                this._sectimer.filters = [FilterConst.glowFilter];
                this._sectimer.timeOutHandler = this.disposeSectimer;
            }
            return;
        }

        /* internal  */disposeSectimer(): void
        {
            if (this._sectimer) 
            {
                DisplayUtil.removeMe(this._sectimer);
                this._sectimer.dispose();
                this._sectimer = null;
            }
            return;
        }

        /* internal */ /* var */_kingChampionShipBtn: GLoadedButton;

        /* internal */ /* var */_sectimer: SecTimerView;
    }
